package com.wk.springboot.contants;

import java.util.HashSet;
import java.util.Set;

public class Consts {
    /**
     * 刷新间隔:不刷新
     */
    public static final String PRE_REFRESH_INTERVAL = "-1";

    /**
     * 副本数量:0
     */
    public static final String PRE_NUMBER_OF_REPLICAS = "0";
    /**
     * 刷新间隔:1s
     */

    public static final String AFTER_REFRESH_INTERVAL = "1s";
    /**
     * 副本数量：1
     */

    public static final String AFTER_NUMBER_OF_REPLICAS = "1";

    public static final String ROW_SPLIT = "\r\n";

    public static final String _ID = "_ID";

    public static final int ES_DELETEBY_IDBULK_SIZE = 1024;

    /**
     * 字段分隔符
     */
    public static final String COLUMN_SPLIT = "$";


    /** ES 索引默认字段 _id */
    public static final String ES_ID = "_id";

    /** ES 索引内置字段 _index */
    public static final String ES_INDEX = "_index";

    /** ES 索引内置字段 _type */
    public static final String ES_TYPE = "_type";

    /** ES 索引内置字段 _score */
    public static final String ES_SCORE = "_score";

    /** ES 索引内置字段 _source */
    public static final String ES_SOURCE = "_source";

    @SuppressWarnings("all")
    public static final Set<String> ES_INDEX_BUILTIN_FIELDS = new HashSet<String>(){{
        add(ES_ID);
        add(ES_INDEX);
        add(ES_TYPE);
        add(ES_SCORE);
        add(ES_SOURCE);
    }};

    public static boolean isBuiltInFieldName(String fieldName){
        return ES_INDEX_BUILTIN_FIELDS.contains(fieldName);
    }
}
